package cai.dao.impl;

import java.util.List;
import java.util.Map;

import search.dao.Impl.UniversalDaoImpl;
import cai.dao.IMailDao;

public class MailDao extends UniversalDaoImpl implements IMailDao {

	public List getListByEndDate() {
		return this.queryForList("select mail,createDate,endDate,enabled from mail where enabled='Y' and (enddate is null or enddate>getdate())");
	}

	public List getListByIsEndDate() {
		return this.queryForList("select mail,createDate,endDate,enabled from mail where enabled='Y' and enddate is not null and enddate<getdate()+30");
	}

	public int getCount() {
		Map m=(Map)this.queryForMap("select count(*) a from mail");
		if(m!=null)
			return (Integer)m.get("a");
		return 0;
	}

}
